global data "C:\Users\ASUS\Documents\4. Asyafina Effect\1. Data"
global hasil "C:\Users\ASUS\Documents\4. Asyafina Effect\2. Hasil"
cd "$hasil"
import excel "$data\https___asyafina.com_-Performance-on-Search-2022-02-16.xlsx", sheet("Tanggal") firstrow clear
tset Tanggal

gen year=year(Tanggal)

*-------------------------------------------------------------------------------------------------------------------------------
* Time Series ARIMA Models in Stata
*-----------------------------------------------------------------------------------------------------------------------------------

global ylist RKT 
global xlist Posisi

asdoc dfuller Klik , save(dfuller) replace 
asdoc dfuller Tayangan , save(dfuller) append
asdoc dfuller Posisi, save(dfuller) append

asdoc dfuller RKT, save(dfuller) append

ardl Klik Tayangan Posisi , lags(1) ec
outreg2 using "Model Ardl.doc", replace ctitle(model ARDL)
ardl Klik Tayangan Posisi if year==2021, lags(1) ec
outreg2 using "Model Ardl.doc", append ctitle(model ARDL tahun 2021)
ardl Klik Tayangan Posisi if year==2022, lags(1) ec
outreg2 using "Model Ardl.doc", append ctitle(model ARDL tahun 2022)
k
asdoc varsoc Klik Tayangan Posisi ,maxlag(8)
asdoc estat ectest
*----------------------------------------------------------
ardl RKT  Posisi , lags(2) ec
outreg2 using "Model Ardl2.doc", replace ctitle(model ARDL)
ardl RKT  Posisi if year==2021, lags(2) ec
outreg2 using "Model Ardl2.doc", append ctitle(Tahun 2021)
ardl RKT  Posisi if year==2022, lags(2) ec
outreg2 using "Model Ardl2.doc", append ctitle(Tahun 2022)


ardl Klik Tayangan Posisi , lags(1) ec
tsappend , add(100)
arima d.Klik , arima(1,0,1)
drop klik_syafina
*forcasting 20 tahun kedepan
predict klik_syafina, y dynamic(d(25may2022  ))




tsline Klik klik_syafina


asdoc varsoc RKT  Posisi ,maxlag(2) save(hasil2)
asdoc estat ectest, save(hasil2)